package com.ygl.strategy.gateway.opentracing.configuration;

import com.ygl.strategy.constant.StrategyConstant;
import com.ygl.strategy.gateway.configuration.GatewayStrategyAutoConfiguration;
import com.ygl.strategy.gateway.opentracing.tracer.DefaultGatewayStrategyOpentracingTracer;
import com.ygl.strategy.gateway.tracer.GatewayStrategyTracer;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * author: yanggld
 * date: 2019/12/22 18:40
 * version: 1.0
 * description: GatewayStrategyOpentracingAutoConfiguration
 */
@Configuration
@AutoConfigureBefore(GatewayStrategyAutoConfiguration.class)
public class GatewayStrategyOpentracingAutoConfiguration {

    @Bean
    @ConditionalOnProperty(value = StrategyConstant.SPRING_APPLICATION_STRATEGY_TRACE_ENABLED, matchIfMissing = false)
    public GatewayStrategyTracer gatewayStrategyTracer() {
        return new DefaultGatewayStrategyOpentracingTracer();
    }
}
